|
|
|
|
|
|
|
Figure 33.4
To use Active Messaging, you must have
OLEMSG32.DLL installed on your system. |
|
|
|
|
| |
|
|
|
|
The examples in this section were created using Microsoft Outlook. Documentation for Active Messaging is available on Microsoft's Web site: |
|
|
|
|
|
|
|
|
www.microsoft.com/ithome/resource/exchange/active/default.htm |
|
|
|
|
|
|
|
|
Microsoft also has expanded Active Messaging functionality in Microsoft Exchange Server 5.5 well beyond messaging and has renamed it Collaboration Data Objects (CDO). For more information, visit the following Web site: |
|
|
|
|
|
|
|
|
www.microsoft.com/exchange/guide/papers/cdo.asp |
|
|
|
|
|
|
|
|
|
|
The first step in working with e-mail from Visual Basic is to start a messaging session. The session represents a connection between your Visual Basic program and the e-mail system. To start a session, you have to create a new session object and then call the Logon method, as in the following example: |
|
|
|
|
|
|
|
|
Dim objSession As Object
Set objSession = CreateObject("MAPI.Session")
objSession.Logon |
|
|
|
|
|
|
|
|
When you start Microsoft Exchange or Outlook interactively, you might have to enter a user name, profile name, or password, depending on how your PC is configured. In the previous code example, we did not provide any of these parameters, so executing these statements would cause the e-mail system to prompt for any necessary logon information. |
|
|
|
|
|
|
|
|
To create any kind of automated e-mail processing program, you need to avoid having dialog boxes appear. To do this, you must provide additional parameters to the Logon method: |
|
|
|
|
|
|
|
|
objSession.Logon "Your Profile Name", , False, False |
|
|
|
|
|
|
|
|
The first two parameters in the previous line of code are the profile name and profile password. If your profile is set up so that it does not need a password, you can leave the password parameter blank, as in the example. |
|
|
|
|
|